#include <stdio.h>
#include <string.h>
#include <math.h>

#include "comm.h"
#include "defines.h"
#include "draw_staff.h"

#define PI		3.14159265358979323846

int main(int argc, char *argv[])
{
	char filename[64] = "kernel.g6a";

	float a;

	if (argc > 1)
	{
		strcpy(filename, argv[1]);
	}

	if (command_init(filename) != 0)
		return -1;

	fprintf(stdout, "gen_kernel: wrting into file %s ...\n", filename);

	graph_startup(C_RED);

	draw_circle(256, 256, 100);

	for (a = 0.0; a < 2 * PI; a += 2 * PI / 5)
	{
		graph_set_color(C_BLACK);
		int ca = 100 * cos(a);

		int sa = 100 * sin(a);

		int caa = 100 * cos(a + 4 * PI / 5);

		int saa = 100 * sin(a + 4 * PI / 5);

		draw_line(256 + sa, 256 - ca, 256 + saa, 256 - caa);

		graph_set_color(C_YELLOW);

		draw_circle(256 + sa, 256 - ca, 12);
	}

	graph_set_color(C_BLUE);
	draw_box(100, 150, 512 - 100, 512 - 150);

	graph_set_color(C_WHITE);
	draw_ellipse(256, 256, 80, 160);

	command_terminate();

	return 0;
}
